After running flame for paired t-test analysis, finish mixed fx workflow


In [2]:
import os
import os.path as op

import numpy as np
import pandas as pd
import nibabel as nib
from scipy.ndimage import binary_dilation
from skimage import morphology
import matplotlib as mpl
import matplotlib.pyplot as plt

from nipype import IdentityInterface, Node, Workflow
from nipype.interfaces.base import (BaseInterface,
                                    BaseInterfaceInputSpec,
                                    InputMultiPath, OutputMultiPath,
                                    TraitedSpec, File, traits)
from nipype.interfaces import fsl, freesurfer

import seaborn as sns
from moss import locator
from moss.mosaic import Mosaic

import lyman
from lyman import tools
from lyman.tools import SaveParameters, add_suffix, nii_to_png


/Users/steph-backup/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))

AP: stress group safe vs. threat SH > CR


In [29]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/AP/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/AP/scripts'
exp = 'ap_memory_raw'
altmodel = 'byshockCond'
subjects = '/Volumes/group/awagner/sgagnon/AP/scripts/subjects_shock_byshockCondSH.txt'
basedir = '/Volumes/group/awagner/sgagnon/AP/analysis/ap_memory_raw-byshockCond/group_stress/safe-threat_sourcehit-cr'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats+/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats+/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()

SST: Control planning (probe - habit)


In [5]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects_control.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group_control/probe-habit'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-02T16:16:28.661851:DLH 0.00709493
INFO:interface:stdout 2017-08-02T16:16:28.661851:VOLUME 208553
INFO:interface:stdout 2017-08-02T16:16:28.661851:RESELS 650.699
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T16:16:30.679957:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T16:16:30.679957:1	59823	1.77e-23	22.8	6	60	76	36	47.3	54.6	47.9
INFO:interface:stdout 2017-08-02T16:16:32.174147:DLH 0.00709493
INFO:interface:stdout 2017-08-02T16:16:32.174147:VOLUME 208553
INFO:interface:stdout 2017-08-02T16:16:32.174147:RESELS 650.699
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T16:16:32.458899:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T16:16:32.458899:1	2744	0.0101	2	4.29	25	56	33	18.8	56.1	45.1

SST: Control nav (probe - habit)


In [7]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects_control.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group_control/nav_probe-habit'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-02T16:47:26.715750:DLH 0.0126696
INFO:interface:stdout 2017-08-02T16:47:26.715750:VOLUME 208553
INFO:interface:stdout 2017-08-02T16:47:26.715750:RESELS 364.389
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T16:47:27.852806:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T16:47:27.852806:1	8124	1.12e-08	7.95	4.99	41	82	52	30.6	77.8	49.8
INFO:interface:stdout 2017-08-02T16:47:29.492612:DLH 0.0126696
INFO:interface:stdout 2017-08-02T16:47:29.492612:VOLUME 208553
INFO:interface:stdout 2017-08-02T16:47:29.492612:RESELS 364.389
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T16:47:30.167913:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T16:47:30.167913:1	28370	9.92e-21	20	5.45	45	53	70	44.6	55	50.6

SST: Stress planning (probe - habit)


In [9]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects_stress.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group_stress/probe-habit'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-02T17:37:35.439309:DLH 0.0125923
INFO:interface:stdout 2017-08-02T17:37:35.439309:VOLUME 213456
INFO:interface:stdout 2017-08-02T17:37:35.439309:RESELS 366.626
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T17:37:36.419013:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T17:37:36.419013:3	10490	2.41e-10	9.62	5.33	36	32	49	44.3	31	55.9
INFO:interface:stdout 2017-08-02T17:37:36.419013:2	5132	3.4e-06	5.47	4.85	64	75	48	64.9	65.7	49.3
INFO:interface:stdout 2017-08-02T17:37:36.419013:1	3931	4.3e-05	4.37	4.57	21	75	49	33.5	71.3	58.4
INFO:interface:stdout 2017-08-02T17:37:37.766138:DLH 0.0125923
INFO:interface:stdout 2017-08-02T17:37:37.766138:VOLUME 213456
INFO:interface:stdout 2017-08-02T17:37:37.766138:RESELS 366.626
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T17:37:38.205035:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T17:37:38.205035:4	7666	2.79e-08	7.55	5.51	55	26	32	44.4	22.6	37.1
INFO:interface:stdout 2017-08-02T17:37:38.205035:3	2526	0.00121	2.92	4.22	12	48	51	17.2	53.7	45.6
INFO:interface:stdout 2017-08-02T17:37:38.208856:2	2158	0.0032	2.49	3.9	39	77	31	45.6	81.5	32.1
INFO:interface:stdout 2017-08-02T17:37:38.208856:1	1980	0.00522	2.28	3.89	73	48	43	69.5	54.7	42.4

SST: Stress nav (probe - habit)


In [8]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects_stress.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group_stress/nav_probe-habit'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-02T17:18:49.798773:DLH 0.00893559
INFO:interface:stdout 2017-08-02T17:18:49.798773:VOLUME 213456
INFO:interface:stdout 2017-08-02T17:18:49.798773:RESELS 516.66
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T17:18:50.452524:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T17:18:52.134072:DLH 0.00893559
INFO:interface:stdout 2017-08-02T17:18:52.134072:VOLUME 213456
INFO:interface:stdout 2017-08-02T17:18:52.134072:RESELS 516.66
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-02T17:18:52.509355:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-02T17:18:52.509355:2	41226	3.18e-21	20.5	5.66	46	52	69	48.3	58.5	47.4
INFO:interface:stdout 2017-08-02T17:18:52.509355:1	2078	0.0161	1.79	5.24	21	26	23	26.2	26.8	24

In [ ]:


In [12]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group/probe-habit_control-stress'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-03T13:39:52.816864:DLH 0.00768363
INFO:interface:stdout 2017-08-03T13:39:52.816864:VOLUME 208223
INFO:interface:stdout 2017-08-03T13:39:52.816864:RESELS 600.844
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-03T13:39:54.045282:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-03T13:39:54.045282:1	59820	9.6e-25	24	7.31	59	76	36	46.8	52.8	48.1
INFO:interface:stdout 2017-08-03T13:39:54.938788:DLH 0.0143179
INFO:interface:stdout 2017-08-03T13:39:54.938788:VOLUME 208223
INFO:interface:stdout 2017-08-03T13:39:54.938788:RESELS 322.44
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-03T13:39:55.162348:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-03T13:39:55.162348:2	5066	1.07e-06	5.97	3.79	68	71	57	59.1	77.9	42.5
INFO:interface:stdout 2017-08-03T13:39:55.162348:1	2700	0.000348	3.46	3.9	45	17	32	46.7	23.6	34.6

In [14]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group/probe-habit_control-stress_mumford'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2, 3]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          peak_distance=exp_info["peak_distance"],
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-03T14:28:18.250612:DLH 0.00703817
INFO:interface:stdout 2017-08-03T14:28:18.250612:VOLUME 208223
INFO:interface:stdout 2017-08-03T14:28:18.250612:RESELS 655.947
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-03T14:28:18.617807:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-03T14:28:18.617807:1	61891	6.72e-24	23.2	6.37	59	75	36	47.3	54.6	47.5
INFO:interface:stdout 2017-08-03T14:28:20.059803:DLH 0.0117295
INFO:interface:stdout 2017-08-03T14:28:20.059803:VOLUME 208223
INFO:interface:stdout 2017-08-03T14:28:20.059803:RESELS 393.594
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-03T14:28:20.437304:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-03T14:28:20.437304:2	11929	8.17e-11	10.1	6.09	36	32	49	44.5	31.2	55.6
INFO:interface:stdout 2017-08-03T14:28:20.437304:1	11363	1.88e-10	9.73	6	64	75	48	49.8	68.5	50.9
INFO:interface:stdout 2017-08-03T14:28:21.727975:DLH 0.014318
INFO:interface:stdout 2017-08-03T14:28:21.727975:VOLUME 208223
INFO:interface:stdout 2017-08-03T14:28:21.727975:RESELS 322.438
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-03T14:28:22.049143:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-03T14:28:22.049143:2	5066	1.07e-06	5.97	3.79	68	71	57	59.1	77.9	42.5
INFO:interface:stdout 2017-08-03T14:28:22.049143:1	2700	0.000348	3.46	3.9	45	17	32	46.7	23.6	34.6

In [16]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group/probe-habit_control-stress_mumford_restrictedROI'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2, 3]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-04T13:39:50.869273:DLH 0.00103033
INFO:interface:stdout 2017-08-04T13:39:50.869273:VOLUME 19330
INFO:interface:stdout 2017-08-04T13:39:50.869273:RESELS 4480.76
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-04T13:39:52.062246:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-04T13:39:52.062246:5	3509	0.0155	1.81	5.54	66	70	54	63.8	74.4	50.8
INFO:interface:stdout 2017-08-04T13:39:52.062246:4	3375	0.0164	1.78	5.65	23	77	52	25	71.6	55.9
INFO:interface:stdout 2017-08-04T13:39:52.062246:3	1782	0.0352	1.45	5.58	26	27	55	23.8	34.1	57.2
INFO:interface:stdout 2017-08-04T13:39:52.062246:2	1544	0.0401	1.4	5.4	61	33	59	62.8	32.5	58.3
INFO:interface:stdout 2017-08-04T13:39:52.062246:1	1279	0.0467	1.33	4.34	33	91	36	29.9	91.2	37.2
INFO:interface:stdout 2017-08-04T13:39:53.973479:DLH 0.00397343
INFO:interface:stdout 2017-08-04T13:39:53.973479:VOLUME 19330
INFO:interface:stdout 2017-08-04T13:39:53.973479:RESELS 1161.88
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-04T13:39:54.398254:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-04T13:39:54.398254:3	1883	0.0144	1.84	6	64	75	48	63.5	69.9	55.9
INFO:interface:stdout 2017-08-04T13:39:54.398254:2	1878	0.0144	1.84	4.75	18	77	49	25.5	70.9	56.4
INFO:interface:stdout 2017-08-04T13:39:54.398254:1	1016	0.0493	1.31	5.04	58	28	60	61.3	31.9	58.8
INFO:interface:stdout 2017-08-04T13:39:55.364238:DLH 0.00739828
INFO:interface:stdout 2017-08-04T13:39:55.364238:VOLUME 19330
INFO:interface:stdout 2017-08-04T13:39:55.364238:RESELS 624.019
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-04T13:39:55.767112:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)

In [17]:
os.environ["SUBJECTS_DIR"] = '/Volumes/group/awagner/sgagnon/SST/data'
os.environ["LYMAN_DIR"] = '/Volumes/group/awagner/sgagnon/SST/scripts'
exp = 'mvpa'
altmodel = 'goodruntype_filt'
subjects = '/Volumes/group/awagner/sgagnon/SST/scripts/subjects.txt'
basedir = '/Volumes/group/awagner/sgagnon/SST/analysis/mvpa-goodruntype_filt/group/probe1v2_control-stress_mumford'

project = lyman.gather_project_info()
exp_info = lyman.gather_experiment_info(exp, altmodel)

subject_list = lyman.determine_subjects([subjects])
subj_source = Node(IdentityInterface(fields=["subject_id"]),
                   name="subj_source")
subj_source.inputs.subject_id = subject_list

for contrast_num in [1, 2, 3]:
    
    # Estimate smoothness
    smoothest = fsl.SmoothEstimate()
    smoothest.inputs.mask_file = basedir + '/stats/mask.nii.gz'
    smoothest.inputs.zstat_file = basedir + '/stats/zstat'+str(contrast_num)+'.nii.gz'
    smooth = smoothest.run()
    
    # Cluster correct
    cluster = fsl.Cluster(in_file=smoothest.inputs.zstat_file,
                          threshold=exp_info["cluster_zthresh"],
                          pthreshold=exp_info["grf_pthresh"],
                          out_threshold_file=basedir+'/zstat'+str(contrast_num)+'_threshold.nii.gz',
                          out_index_file=basedir+'/zstat'+str(contrast_num)+'_index.nii.gz',
                          out_localmax_txt_file=basedir+'/zstat'+str(contrast_num)+'_localmax.txt',
                          use_mm=True,
                          dlh=smooth.outputs.dlh,
                          volume=smooth.outputs.volume)
    cluster.run()


INFO:interface:stdout 2017-08-08T09:59:00.534296:DLH 0.0175147
INFO:interface:stdout 2017-08-08T09:59:00.534296:VOLUME 208256
INFO:interface:stdout 2017-08-08T09:59:00.534296:RESELS 263.587
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-08T09:59:01.609877:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-08T09:59:01.609877:4	2996	3.47e-05	4.46	4.65	72	43	39	71.8	47.2	37.7
INFO:interface:stdout 2017-08-08T09:59:01.609877:3	1860	0.00141	2.85	3.72	46	88	27	36.4	88	40.7
INFO:interface:stdout 2017-08-08T09:59:01.609877:2	1716	0.00236	2.63	3.94	71	71	39	64.7	73.8	41.3
INFO:interface:stdout 2017-08-08T09:59:01.609877:1	1631	0.00323	2.49	3.83	58	89	45	52	87.7	49.4
INFO:interface:stdout 2017-08-08T09:59:03.755797:DLH 0.0045144
INFO:interface:stdout 2017-08-08T09:59:03.755797:VOLUME 208256
INFO:interface:stdout 2017-08-08T09:59:03.755797:RESELS 1022.65
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-08T09:59:04.228947:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-08T09:59:05.309919:DLH 0.0048401
INFO:interface:stdout 2017-08-08T09:59:05.309919:VOLUME 208256
INFO:interface:stdout 2017-08-08T09:59:05.309919:RESELS 953.835
/Users/steph-backup/anaconda/lib/python2.7/site-packages/nipype-0.11.0-py2.7.egg/nipype/interfaces/base.py:419: UserWarning: Input pthreshold requires inputs: dlh, volume
  warn(msg)
INFO:interface:stdout 2017-08-08T09:59:05.666051:Cluster Index	Voxels	P	-log10(P)	MAX	MAX X (vox)	MAX Y (vox)	MAX Z (vox)	COG X (vox)	COG Y (vox)	COG Z (vox)
INFO:interface:stdout 2017-08-08T09:59:05.666051:1	46232	2.25e-15	14.6	5.36	71	72	38	46.9	58.7	43.1

In [ ]: